<?php
	/**
	 * 获取专属房信息
	 */
    class GetExclusiveRoom extends APIBase {
		
		public $tag = "GetExclusiveRoom";
		public $isLogin = true;
		
		public function before() {
			$this->initCacheRedis();
			$this->initMysql();
			return true;
		}

		public function logic() {
			$playerID = $this->uid;
			$vipinfo = $this->cache_redis->hGetAll("hvip:".$playerID);
			if(!empty($vipinfo)){
				if((strtotime(date('Y-m-d',time()))-strtotime(date('Y-m-d',$vipinfo['vip_time'])))/24/3600<=$vipinfo['days']){
				    $ExclusiveRoom = $this->cache_redis->hGetAll("hExclusiveRoom:".$playerID);
					$ExclusiveRoom['level'] = $vipinfo['level'];
					$ExclusiveRoom['days'] = $vipinfo['days']- (strtotime(date('Y-m-d',time()))-strtotime(date('Y-m-d',$vipinfo['vip_time'])))/24/3600;			    
					$this->returnData($ExclusiveRoom);
			    }else{
				    $this->returnError(301,"vip已过期");
			    }
			}else{
				$this->returnError(302,"不是vip");
			}
			
		}
		
    	public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
